<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <div id="app">
        <span v-for="(item,index) in num" :key="index">{{item}}</span>
        <p v-for="(item,index) in users" :key="index">
           {{item.name}}
            <a v-if="index==1" href="javascript:void (0)" @click="delUser(index)">删除</a>
            <a href="javascript:void (0)" @click="updateUser(index)">修改</a>
        </p>
    </div>
</body>
<script src="./js/vue.js" type="text/javascript"></script>
<script>
    new Vue({
        el:"#app",
        data:{
            num:[1,2,3,4,5,6],
            users:[
                {"name":"lisi","age":12},
                {"name":"zs","age":11},
                {"name":"ww","age":33}
            ]
        },
        methods:{
            delUser(index){
                console.log("///////////////////////////");
                console.log(this.users.splice(index,1));
                console.log("///////////////////////////");
                this.users.splice(index,1);
            },
            updateUser:function (index) {
                var user={"name":"ll","age":44}
                this.users.push(user)
                /*var user={"name":"ll","age":44};
                console.log(this.users[index])
                this.users[index].name ="ddd";*/
            }
        }
    })

</script>
</html>